import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:paly_android/api/api.dart';
import 'package:paly_android/bean/banner_entity.dart';
import 'package:paly_android/net/dio_client.dart';

class BannerBloc extends Cubit<List<BannerEntity>> {

  BannerBloc() : super(List.empty(growable: true));

  void getBanner() {
    DioClient.instance.get(Api.BANNER, onSuccess: (List<BannerEntity> entity) {
      state.clear();
      state.addAll(entity);
      emit(state);
    });
  }
}
